package bj.gui

import scala.swing.event
import event.ButtonClicked
import scala.swing.Frame
import scala.swing.Label
import scala.swing.Swing
import scala.swing.Button
import scala.swing.FlowPanel
import scala.swing.GridPanel
import javax.swing.ImageIcon
import scala.swing.Component
import scala.swing.BoxPanel
import scala.swing.Orientation

/** Displays any Swing component within a pop up notification window customized with the green background and Blackjack Logo */
class BjInfoBox(val inComp: Component) extends Frame {
  title = "Blackjack - Informational"
  minimumSize = Constants.infoBoxSize

  val okButton = new Button { text = "OK" }

  contents = new BoxPanel(Orientation.Vertical) {
    contents += new FlowPanel() {
      contents +=
        new Label {
          icon = new ImageIcon("images/BJLogo2.gif")
        }
      background = Constants.greenBack
    }
    contents += new FlowPanel() {
      contents += inComp
      background = Constants.greenBack
    }
    contents += new FlowPanel() {
      contents += okButton
      background = Constants.greenBack
    }
    border = Swing.EmptyBorder(25)
    background = Constants.greenBack
  }
  listenTo(okButton)
  reactions += {
    case ButtonClicked(okButton) => this.close();
  }
  visible = true
}

